# -*- coding: utf-8 -*-
from scrapy.crawler import CrawlerProcess
from scrapy.utils.project import get_project_settings
from taobao_category.spiders.test_one_spider import TestOneSpider
from taobao_category.utils.global_manager import set_value

if __name__ == '__main__':
    # 爬c店
    with open('c_shop.csv', 'r') as csvfile:
        reader = csvfile.read()
        shop_id_list = reader.split()[1:]
        set_value('shop_id_list', shop_id_list)
        csvfile.close()
    settings = get_project_settings()
    process = CrawlerProcess(settings)
    spider = TestOneSpider
    process.crawl(spider)
    process.start()